<?php 
/**
 * 其它费用model
 * @Author    紫梦
 * @DateTime  2017-11-13
 * @copyright 响响租车
 * @version   1.0
 * @update    2018-01-26     
 */
namespace app\common\model;
use think\Model;

class Fees extends Model
{
	protected $type = [
	        'time' => 'timestamp:Y-m-d',           
	    ];
    protected $insert = ['agency_id'];
    
    protected function setAgencyIdAttr()
    {
        return session('admin.agency_id');
    }

    // 定义全局的查询范围
    protected static function base($query)
    {
        $agency = session('admin.agency_id');
        if($agency==1){
            // $query->where('delete_time',null);

        }else{
            $query->where(['agency_id'=>$agency]);

        }
                    
    } 
}